package com.tele.service.imps;

import com.tele.domain.Solution;
import com.tele.domain.vo.SolutionVo;
import com.tele.mapper.SolutionMapper;
import com.tele.service.ints.SolutionService;
import org.springframework.stereotype.Service;

import java.util.List;
import javax.annotation.Resource;

/**
 * (Solution)表服务实现类
 *
 * @author makejava
 * @since 2023-08-23 14:49:44
 */
@Service("solutionService")
public class SolutionServiceImpl implements SolutionService{
    @Resource
    private SolutionMapper solutionMapper;

    /**
     * 查询所有数据
     *
     * @return 实例对象集合
     */
    @Override
    public List<SolutionVo> queryAll() {
        return this.solutionMapper.queryAll();
    }

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public Solution queryById(Long id) {
        return this.solutionMapper.queryById(id);
    }

    /**
     * 新增数据
     *
     * @param solution 实例对象
     * @return 实例对象
     */
    @Override
    public Solution insert(Solution solution) {
        this.solutionMapper.insert(solution);
        return solution;
    }

    /**
     * 修改数据
     *
     * @param solution 实例对象
     * @return 实例对象
     */
    @Override
    public Solution update(Solution solution) {
        this.solutionMapper.update(solution);
        return this.queryById(solution.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.solutionMapper.deleteById(id) > 0;
    }
}

